# 输入一行仅由 ()[]组成的字符串
# 输入出字符串匹配括号的长度
# 例如：[((][()](),结果是4
m = 0
list_1 = []
str_1 = '[((][()]()'
# str_1 = '[([])'
for i in str_1:
    if i =='[' or i == '(':
        list_1.append(i)
    if i ==']' :
        if '[' in list_1:
            list_1.remove('[')
            m += 1
    if i == ')':
        if '(' in list_1:
            list_1.remove('(')
            m +=1
print(list_1)
print(m)
        
        
